/**
 入驻小区
 **/
(function(vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    vc.extends({
        data: {
            aRoomDetailReceiptInfo: {
                feeReceipts: [],
                payObjId: '',
                feeId:'',
                total: '',
                records: '',
                selectReceipts: [],
                quan: false,
                printUrl: '/print.html#/pages/property/printPayFee',
            }
        },
        _initMethod: function() {},
        _initEvent: function() {
            //切换 至费用页面
            vc.on('aRoomDetailReceipt', 'switch', function(_param) {
                if (_param.ownerId == '') {
                    return;
                }
                 $that.aRoomDetailReceiptInfo.payObjId = _param.ownerId;
                 $that.aRoomDetailReceiptInfo.feeId = _param.feeId;
                $that._listARoomDetailReceipt(DEFAULT_PAGE, DEFAULT_ROWS);
            });
            vc.on('aRoomDetailReceipt', 'paginationPlus', 'page_event',
                function(_currentPage) {
                    $that._listARoomDetailReceipt(_currentPage, DEFAULT_ROWS);
                });
        },
        methods: {
            _listARoomDetailReceipt: function(_page, _rows) {
                $that.aRoomDetailReceiptInfo.selectReceipts = [];
                $that.aRoomDetailReceiptInfo.quan = false;
                let param = {
                    params: {
                        page: _page,
                        row: _rows,
                        payObjId: $that.aRoomDetailReceiptInfo.payObjId,
                        feeId: $that.aRoomDetailReceiptInfo.feeId,
                    }
                };
                //发送get请求
                vc.http.apiGet('/receipt.queryAdminFeeReceipt',
                    param,
                    function(json, res) {
                        let _json = JSON.parse(json);
                        $that.aRoomDetailReceiptInfo.total = _json.total;
                        $that.aRoomDetailReceiptInfo.records = _json.records;
                        $that.aRoomDetailReceiptInfo.feeReceipts = _json.data;
                        vc.emit('aRoomDetailReceipt', 'paginationPlus', 'init', {
                            total: $that.aRoomDetailReceiptInfo.records,
                            dataCount: $that.aRoomDetailReceiptInfo.total,
                            currentPage: _page
                        });
                    },
                    function(errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            _queryFeeReceiptMethod: function() {
                $that._listARoomDetailReceipt(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            
        }
    });
})(window.vc);